package com.gitee.xhs.broadcastState;

import com.gitee.xhs.sourceIterator.AbstractSourceIterator;

/**
 * @author BigHead
 * @date 2022/7/4 16:12
 * @description BroadcastStateDaoIterator
 */
public class BroadcastStateDaoIterator extends AbstractSourceIterator<BroadcastStateDao> {

    private int index = 1;
    private final int maxIndexNum;

    public BroadcastStateDaoIterator(int maxIndexNum) {
        this.maxIndexNum = maxIndexNum;
    }

    @Override
    public boolean hasNext() {
        return true;
    }

    @Override
    public BroadcastStateDao next() {
        if (index > maxIndexNum) {
            index = 1;
        }
        BroadcastStateDao broadcastStateDao = new BroadcastStateDao(index);
        broadcastStateDao.setDataTime(iteratorTime(null));
        index += 1;
        return broadcastStateDao;
    }
}
